<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>News1</title>
    <script src="/webjars/jquery/jquery.min.js"></script>
</head>
<body>
<h1 style="text-align: center">新闻1</h1>
阅读数<font color="red" th:text="${read}"></font>&nbsp;&nbsp;
点赞数<font id="countZan" color="red" th:text="${zan}"></font>&nbsp;&nbsp;
<button type="button" onclick="zan(1)" value="点赞"/>
<script type="text/javascript">
    function zan(id){
        $.ajax({
            url: "/addZan",
            type: "get",
            data: "id="+id,
            success: function (data){
                $("#countZan").text(data);
            }
        })
    }
</script>
</body>
</html>